Skip to content
  • 0 Votes
    2 Posts
    1k Views
    Pablo J. RoginaP

    @Ilan

    My question is what method of the widget does the Qt designer use for showing

    If you mean Qt Designer showing your custom widget in the toolbox along default widgets (i.e. QLabel, QLineEdit, etc.) I guess you may need to create a plugin for Qt Designer from your custom widget. Qt Designer used a plugin based approach, see here.

  • 0 Votes
    4 Posts
    1k Views
    mrjjM

    @Sh1gs
    Just as a note.
    There is no difference adding widgets in code or adding via Designer.
    The setupUI() as seen in mainwindow ctor creates the Designer widgets as code.

    So the only true difference is handwritten versus generated from UI file.
    Also adding via Designer, gives easier translations as the translate function is generated for the user.

  • 0 Votes
    16 Posts
    6k Views
    Ioseph12I

    @VRonin

    After some headache days I found the problem. The FilterWindow widget had set wrong the parent in children widgets, so, the right way would be :

    void FilterWindow::setUi(std::string tittle) { Frame = new QFrame(this); //Here it must be this, to set the widget itself as the parent Frame->setObjectName(QStringLiteral("Frame")); Frame->setFixedWidth(281); Frame->setFixedHeight(89); Frame->setStyleSheet(QLatin1String("QFrame\n" "{\n" " border-style: solid;\n" " border-width: 0px;\n" " border-radius: 4px;\n" " border-color: transparent;\n" "}")); Frame->setFrameShape(QFrame::StyledPanel); Frame->setFrameShadow(QFrame::Raised); Frame->setAttribute(Qt::WA_DeleteOnClose); checkBox = new QCheckBox(Frame); checkBox->setText(tittle.c_str()); checkBox->setObjectName(QStringLiteral("checkBox")); checkBox->setGeometry(QRect(0, 0, 248, 35)); checkBox->setAutoFillBackground(false); checkBox->setStyleSheet(QLatin1String("QCheckBox\n" "{\n" " background-color: rgb(128,139,143);\n" " color: white;\n" " border-radius: 4px;\n" " padding-left: 8px;\n" "}\n" "\n" "QCheckBox::indicator:unchecked {\n" " image: url(:/OptiNanoPro/uchk);\n" "}\n" "\n" "\n" "QCheckBox::indicator:checked {\n" " image: url(:/OptiNanoPro/chk);\n" "}\n" "")); checkBox->setChecked(true); ArrowBtn = new QPushButton(Frame); ArrowBtn->setObjectName(QStringLiteral("ArrowBtn")); ArrowBtn->setGeometry(QRect(246, 0, 36, 35)); ArrowBtn->setAutoFillBackground(true); QIcon icon; icon.addFile(QStringLiteral(":/OptiNanoPro/DownArrwLd"), QSize(), QIcon::Normal, QIcon::Off); ArrowBtn->setIcon(icon); ArrowBtn->setIconSize(QSize(36, 35)); ArrowBtn->setFlat(true); Table = new QTableWidget(Frame); Table->setObjectName(QStringLiteral("Table")); Table->setGeometry(QRect(0, 35, 281, 31)); Table->setStyleSheet(QLatin1String("QTableWidget\n" "{\n" " background-color: white;\n" " border-radius: 0px;\n" "}" "\n" "QCheckBox\n" "{\n" " color: white;\n" " padding-left: 8px;\n" "}\n" "\n" "QCheckBox::indicator:unchecked {\n" " image: url(:/OptiNanoPro/uchk);\n" "}\n" "\n" "QCheckBox::indicator:checked {\n" " image: url(:/OptiNanoPro/chk);\n" "}\n" "")); ResetBtn = new QPushButton(Frame); ResetBtn->setText("Reset"); ResetBtn->setObjectName(QStringLiteral("ResetBtn")); ResetBtn->setGeometry(QRect(0, 66, 169, 23)); ResetBtn->setStyleSheet(QLatin1String("QPushButton\n" "{\n" " background-color: white;\n" " border-width: 1px;\n" " border-style: solid;\n" " border-color: rgb(86,86,84);\n" " border-radius: 3px;\n" " color: rgb(86,86,84);\n" "}")); AplyBtn = new QPushButton(Frame); AplyBtn->setText("Apply"); AplyBtn->setObjectName(QStringLiteral("AplyBtn")); AplyBtn->setGeometry(QRect(169, 66, 111, 23)); AplyBtn->setStyleSheet(QLatin1String("QPushButton\n" "{\n" " background-color: white;\n" " border-width: 1px;\n" " border-style: solid;\n" " border-color: rgb(86,86,84);\n" " border-radius: 3px;\n" " color: rgb(86,86,84);\n" "}")); }
  • 0 Votes
    6 Posts
    2k Views
    mrjjM

    @Sh1gs
    Just as a note.
    You can visually design the UI in Designer and then just grab the c++ code. ;)
    If you look inside the setupUI, there is the code for what u have"drawn"

  • 0 Votes
    3 Posts
    2k Views
    l1q1d56L

    Hi @Joel-Bodenmann , thank you, I got the point about the item delegate but I see two issues:

    implement a drag and drop listview because I ended up with empty lines (on the list view) and fields on the widget mapper:
    https://s32.postimg.org/47yyrq7id/Untitled.png implement a delegate that paint a checkbox with custom pixmap, the input with number and the input with text.
  • 0 Votes
    10 Posts
    7k Views
    kshegunovK

    @Prisco
    I'm glad it worked out.
    Good luck with your project!

  • 0 Votes
    4 Posts
    2k Views
    mrjjM

    @ghielmetti
    Hi
    Normally I do have the .h file in the project folder and point to that in the
    Promote dialog.
    Im not sure it will take a full path in the dialog but I never tried :)

  • 0 Votes
    2 Posts
    934 Views
    SGaistS

    Hi,

    You followed the "simple way" of creating a Designer plugin.

    For a "real world" approach take a look at this.

    Short version: you split your plugin code in two:

    a library which will include your widget(s) the plugin itself

    That way you have the plugin for designer and you can link your application to the library which will not have any dependency on designer related code.

    Hope it helps

  • 0 Votes
    8 Posts
    3k Views
    kshegunovK

    @raven-worx
    Hello,
    Thanks for the code, but I know how to do the scheduling. I actually went with QPointer<QObject> since the QObject might be deleted while waiting in the event loop. Like this:

    bool AgDial::eventFilter(QObject * object, QEvent * event) { switch (event->type()) { case QEvent::ChildAdded: QMetaObject::invokeMethod(this, "scheduleChildAdd", Qt::QueuedConnection, Q_ARG(QPointer<QObject>, QPointer<QObject>(reinterpret_cast<QChildEvent *>(event)->child()))); break; case QEvent::ChildRemoved: d()->detachAction(reinterpret_cast<QChildEvent *>(event)->child()); break; } return QStackedWidget::eventFilter(object, event); }

    Thanks for taking the time though!

    Kind regards.

  • 0 Votes
    4 Posts
    2k Views
    t.dechangyT

    Hi @maximo, did you have success with the MacNativeWidget and didi it reach your requirements.

  • 0 Votes
    2 Posts
    2k Views
    SGaistS

    Hi,

    That generally means that you are trying to use a plugin built with a version of Qt (e.g. 5.5) with an application built with a different version (e.g. 5.4)

    So check what version of Qt was used to build Qt Creator and use it to build your plugin.

  • 0 Votes
    3 Posts
    1k Views
    A

    @p3c0 Thank you! Works fine.

  • 0 Votes
    4 Posts
    1k Views
    SGaistS

    Hi and welcome to devnet,

    How are you calling findChildren ?